new Vue({
  el: '#app',
  data() {
    return {
      form: {
        Parent: "",
        page: 1,			//页数
        limit: 10			//每页数据条数
      },
      formData: {},
      tableData: [{}],		//表格数据
      total: 0,
      dialogForm: false,
      title: '',
      TypeList: [],
      multipleSelection: []
    }
  },
  mounted() {
    this.getList(this.form)
    let arr = [{
      label: '有分享者',
      value: '1'
    }, {
      label: '无分享者',
      value: '0'
    }]
    arr.forEach(item => {
      this.TypeList.push(item)
    })

  },
  computed: {
    formatOpenId() {
      return function (Open_Id) {
        if (Open_Id == 0) {
          return '非分享页进入'
        } else {
          return Open_Id
        }
      }
    }
  },
  methods: {
    onSerach() {				//查询方法
      this.getList(this.form)
    },
    addContract() {
      console.log("跳转")
    },//去重
    duplicateRemoval(arr) {
      let newArr = [];
      for (let i = 0; i < arr.length; i++) {
        if (newArr.indexOf(arr[i].Open_Id) === -1) {
          newArr.push(arr[i]);
        }
      }
      return newArr;
    },
    handleSizeChange(val) {
      this.form.page = 1;
      this.form.limit = val;
      this.getList(this.form)
    },
    handleCurrentChange(val) {
      this.form.page = val;
      this.getList(this.form)
    },
    getList(data) {     //换页方法
      let _this = this
      $.ajax({
        type: 'POST',
        url: DomainName + "/OpenId_Page",
        data,
        complete: function (XMLHttpRequest) {
          _this.loading = false
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        success: function (Result) {
          console.log(Result);
          _this.tableData = Result.tableData     //将获取的数据存到表格数据中
          _this.total = parseInt(Result.limit)
        },
        dataType: "json"
      });
    },
    addEnterprise() {
      window.location.href = './Add.html'
    },
    showMember(Parent_Open_ID) {
      if (Parent_Open_ID != 0) {
        sessionStorage.setItem("Parent_Open_ID", Parent_Open_ID)
        window.location.href = './show.html?Parent_Open_ID=' + Parent_Open_ID
      } else {
        this.$message("该日志没有分享者")
      }
    },
    editMember(EnterpriseInfo_SerialNumber) {
      sessionStorage.setItem("EnterpriseInfo_SerialNumber", EnterpriseInfo_SerialNumber)
      window.location.href = './Edit.html?EnterpriseInfo_SerialNumber=' + EnterpriseInfo_SerialNumber
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    }
  },
})